import request from '@/router/axios';

// 查询权限策略列表 分页
export const getList = (params) => {
    return request({
        url: '/api/manager-api/mx-policy/page',
        method: 'get',
        params
    })
}

// 新增权限策略
export const save = (data) => {
    return request({
        url: '/api/manager-api/mx-policy/save',
        method: 'post',
        data: data
    })
}

// 修改权限策略
export const update = (data) => {
    return request({
        url: '/api/manager-api/mx-policy/update',
        method: 'post',
        data: data
    })
}

// 关联条件
export const conditionList = (params) => {
    return request({
        url: '/api/manager-api/mx-policy-condition/list',
        method: 'get',
        params:params
    })
}

// 获取操作列表
export const operateGroupList = (params) => {
    return request({
        url: '/api/manager-api/mx-policy/operateGroupList',
        method: 'get',
        params
    })
}

// 获取操作列表
export const attributeList = (params) => {
    return request({
        url: '/api/manager-api/mx-attribute/listAllAttribute',
        method: 'get',
        params: {
            refType: "1",
            ...params
        }
    })
}

// 获取权限策略详情
export const detail = (params) => {
    return request({
        url: '/api/manager-api/mx-policy/detail',
        method: 'get',
        params
    })
}


// 删除 权限策略
export const del = (params) => {
    return request({
        url: '/api/manager-api/mx-policy/delete',
        method: 'post',
        params
    })
}


/**
 * @param params 启用 策略条件
 * */
export const start = (params) => {
    return request({
        url: '/api/manager-api/mx-policy/startUsing',
        method: 'post',
        params
    })
}

/**
 * @param params 停用 策略条件
 * */
export const stop = (params) => {
    return request({
        url: '/api/manager-api/mx-policy/stopUsing',
        method: 'post',
        params
    })
}

/**
 * @param params 检出 策略条件
 * */
export const checkout = (params) => {
    return request({
        url: '/api/manager-api/mx-policy/checkout',
        method: 'post',
        params
    })
}

/**
 * @param params 检入 策略条件
 * */
export const publish = (params) => {
    return request({
        url: '/api/manager-api/mx-policy/checkin',
        method: 'post',
        params
    })
}

/**
 * @param params 撤销检出 策略条件
 * */
export const unCheckOut = (params) => {
    return request({
        url: '/api/manager-api/mx-policy/revokeCheckout',
        method: 'post',
        params
    })
}
